package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.PoliceStationMapper;
import com.ruoyi.system.domain.PoliceStation;
import com.ruoyi.system.service.IPoliceStationService;
import com.ruoyi.common.core.text.Convert;

/**
 * 派出所Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-10-15
 */
@Service
public class PoliceStationServiceImpl implements IPoliceStationService 
{
    @Autowired
    private PoliceStationMapper policeStationMapper;

    /**
     * 查询派出所
     * 
     * @param pid 派出所主键
     * @return 派出所
     */
    @Override
    public PoliceStation selectPoliceStationByPid(Long pid)
    {
        return policeStationMapper.selectPoliceStationByPid(pid);
    }

    /**
     * 查询派出所列表
     * 
     * @param policeStation 派出所
     * @return 派出所
     */
    @Override
    public List<PoliceStation> selectPoliceStationList(PoliceStation policeStation)
    {
        return policeStationMapper.selectPoliceStationList(policeStation);
    }

    /**
     * 新增派出所
     * 
     * @param policeStation 派出所
     * @return 结果
     */
    @Override
    public int insertPoliceStation(PoliceStation policeStation)
    {
        policeStation.setCreateTime(DateUtils.getNowDate());
        return policeStationMapper.insertPoliceStation(policeStation);
    }

    /**
     * 修改派出所
     * 
     * @param policeStation 派出所
     * @return 结果
     */
    @Override
    public int updatePoliceStation(PoliceStation policeStation)
    {
        return policeStationMapper.updatePoliceStation(policeStation);
    }

    /**
     * 批量删除派出所
     * 
     * @param pids 需要删除的派出所主键
     * @return 结果
     */
    @Override
    public int deletePoliceStationByPids(String pids)
    {
        return policeStationMapper.deletePoliceStationByPids(Convert.toStrArray(pids));
    }

    /**
     * 删除派出所信息
     * 
     * @param pid 派出所主键
     * @return 结果
     */
    @Override
    public int deletePoliceStationByPid(Long pid)
    {
        return policeStationMapper.deletePoliceStationByPid(pid);
    }
}
